import request from '@/utils/request'
import apis from '@/api'

export function getFirstCategory () {

}

export function getProductDetail (id) {
  return request({
    url: `${apis.ProductDetail}?gid=${id}`,
    method: 'get'
  })
}

export function getProductByCategory (id) {
  return request({
    url: `${apis.ProductByCategory}?id=${id}`,
    method: 'get'
  })
}

export function getProductBySecond (id) {
  return request({
    url: `${apis.ProductBySecond}?id=${id}`,
    method: 'get'
  })
}

// 后期需要删除
export function addCategory (data) {
  return request({
    url: apis.AddCategory,
    method: 'post',
    data: data
  })
}

export function getAddSecondCategory () {
  return request({
    url: apis.AddSecondCategory,
    method: 'get'
  })
}

export function postAddSecondCategory (data) {
  return request({
    url: apis.AddSecondCategory,
    method: 'post',
    data: data
  })
}

export function getAddProduct () {
  return request({
    url: apis.AddProduct,
    method: 'get'
  })
}

export function postAddProduct (data) {
  return request({
    url: apis.AddProduct,
    method: 'post',
    data: data
  })
}

export function search (keyword) {
  return request({
    url: `${apis.SearchProduct}?title=${keyword}`,
    method: 'get'
  })
}
